package org.tp8.sampleapp.service.intf;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Use;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.stereotype.Service;
import org.tp8.sampleapp.exc.SampleAppException;
import org.tp8.sampleapp.model.Course;
import org.tp8.sampleapp.model.Teacher;

/**
 * The Interface JMSService.
 */
@Path("/jms")
@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED, use = Use.LITERAL)
@Service("jmsService")
public interface JMSService {

	/**
	 * Send.
	 * 
	 * @param <T>
	 *            the generic type
	 * @param teacher
	 *            the teacher
	 * @return
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	@WebResult(name = "result")
	@WebMethod(operationName = "sendTeacher")
	@Path("/send/teacher")
	@POST
	@Consumes(value = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	@Produces(value = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	public Teacher sendTeacher(Teacher teacher) throws SampleAppException;

	/**
	 * Send course message.
	 * 
	 * @param <T>
	 *            the generic type
	 * @param teacher
	 *            the teacher
	 * @return
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	@WebResult(name = "result")
	@WebMethod(operationName = "sendCourse")
	@Path("/send/course")
	@POST
	@Consumes(value = { MediaType.APPLICATION_FORM_URLENCODED })
	@Produces(value = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
	public Course sendCourse(
			@FormParam("courseName") @WebParam(name = "courseName", partName = "param") String courseName)
			throws SampleAppException;

}
